package com.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


@Component("car4")
public class Car {

    //@Value("BYD")
    private String brand; //品牌
    //@Value("blue")
    private String color; //颜色
    //@Value("120000")
    private int price; //价格

    public Car() {
    }

    public Car(String brand, String color, int price) {
        System.out.println("执行了Car带三个参数的构造方法...");
        this.brand = brand;
        this.color = color;
        this.price = price;
    }

    public String getBrand() {
        return brand;
    }

    @Value("BYD")
    public void setBrand(String brand) {
        System.out.println("执行了setBrand(String),参数brand:"+brand);
        this.brand = brand;
    }

    public String getColor() {
        return color;
    }

    @Value("blue")
    public void setColor(String color) {
        System.out.println("执行了setColor(String),参数color:"+color);
        this.color = color;
    }

    public int getPrice() {
        return price;
    }


    @Value("120000")
    public void setPrice(int price) {
        System.out.println("执行了setPrice(int),参数price:"+price);
        this.price = price;
    }

    @Override
    public String toString() {
        return "Car{" +
                "brand='" + brand + '\'' +
                ", color='" + color + '\'' +
                ", price=" + price +
                '}';
    }
}
